using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter43
{
	/// <summary>
	/// Example02: Vibration of the CO Molecule
	/// The frequency of the photon that causes the v = 0 to   
	/// v = 1 transition in the CO molecule is 6.42 \times 10^{13} Hz.
	/// We will ignore any changes in the rotational energy for this example.
	/// (A)	
	/// Calculate the force constant k for this molecule.
	/// (B)	
	/// What is the maximum classical amplitude of vibration 
	/// for this molecule in the v = 0 vibrational state?
	/// </summary>
	public class Example02
	{
		public Example02()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Molecule CO = new L.Molecule();
			CO.Frequency = 6.42E13;
			CO.VibrationalQuantumNumber = 1;
			double Ei = CO.VibrationalEnergy;
			CO.VibrationalQuantumNumber = 0;
			double Ef = CO.VibrationalEnergy;
            result+=Convert.ToString(Ei - Ef)+"\r\n";
			L.SimpleHarmonicMotion obj = new L.SimpleHarmonicMotion();
			obj.Frequency = CO.Frequency;
			obj.FindAngularFrequencyFromFrequency();
			obj.Mass = 1.14E-26;
			obj.FindSpringForceConstant();
			result+=Convert.ToString(obj.SpringForceConstant)+"\r\n";
			obj.Amplitude = Math.Sqrt(Ef*2.0/obj.SpringForceConstant);
			result+=Convert.ToString(obj.Amplitude)+"\r\n";
		}
	}
}
